﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MSProject=Microsoft.Office.Interop.MSProject;

using DataDesign.MPP.AddIn;
using DataDesign.MPP.Domain;

namespace DataDesign.MPP.AddIn.Forms
{
    public partial class frmOpenInput : Form
    {
        private MSProject.Project _msProject;
        private MSProject.Application _mspApplication;
        public frmOpenInput(MSProject.Project MSProject,MSProject.Application MSPApplication)
        {
            _msProject = MSProject;
            _mspApplication = MSPApplication;
            InitializeComponent();
        }

        private void OpenInput_Load(object sender, EventArgs e)
        {
            Manager.ProjectManager prManager = Manager.ProjectManager.GetInstance(_mspApplication, _msProject);
            GetListForSubproject(prManager);
            GetListForType();
            prManager.GetListCustomFeilds();
        }
        private void GetListForSubproject(Manager.ProjectManager prManager)
        {
            List<string> lstSubProject = prManager.GetListSubProjectName();
            lstSubProject.Insert(0, string.Empty);
            cmbSubprojects.DataSource = lstSubProject;
            
        }
        private void GetListForType()
        {
            Dictionary<int, string> generalType = GeneralType.GetDictionary();
            cmbType.DataSource = generalType.Values.ToList();
        }
        private void btnCancle_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
